import { defineStore } from 'pinia';  
export const useStore = defineStore('todolist', {   
 
  state: () => ({
    newlist: '',
    message:'',
    active: false,
    lists: [ ] as [],  
  }),
  actions: {
    addlist(newlist: string){
      this.lists.push(newlist);
      newlist='';
  },
    deletelist( index: number) {
      this.lists.splice(index, 1);
    },
    changelist(index:number){
      this.lists[index] = '';
    },
    savelist(index:number , message:string){
      this.lists[index] = message;
    },
  },
});
